<template>
  <el-container class="container">
    <el-header class="header">
      <el-row type="flex" justify="space-between" align="middle">
        <el-col :span="19" class="middle">
          <h2>单车租赁管理系统</h2>
        </el-col>
        <el-col :span="5" class="logout">
          <el-link @click="logout" class="logout-link"><i class="el-icon-switch-button"></i> 退出</el-link>
        </el-col>
      </el-row>
    </el-header>
    <el-container>
      <el-aside class="aside" width="200px">
        <el-menu default-active="2-1" class="menu" :unique-opened="true" :router="true">
          <el-submenu index="1">
            <template slot="title">
              <i class="el-icon-location"></i>
              <span>车辆管理</span>
            </template>
            <el-menu-item index="/Abike">
              <i class="el-icon-location"></i>
              车辆列表
            </el-menu-item>
          </el-submenu>
          <el-submenu index="2">
            <template slot="title">
              <i class="el-icon-user"></i>
              <span>用户管理</span>
            </template>
            <el-menu-item index="/Auser">
              <i class="el-icon-user"></i>
              用户列表
            </el-menu-item>
            <el-menu-item index="/Ame">
              <i class="el-icon-user"></i>
              个人信息
            </el-menu-item>
          </el-submenu>
          <el-submenu index="3">
            <template slot="title">
              <i class="el-icon-time"></i>
              <span>订单管理</span>
            </template>
            <el-menu-item index="/Aorder">
              <i class="el-icon-time"></i>
              订单列表
            </el-menu-item>
          </el-submenu>
          <el-submenu index="4">
            <template slot="title">
              <i class="el-icon-data-analysis"></i>
              <span>数据统计</span>
            </template>
            <el-menu-item index="/Adata">
              <i class="el-icon-data-analysis"></i>
              数据报表
            </el-menu-item>
          </el-submenu>
        </el-menu>
      </el-aside>
      <el-main class="main">
        <router-view></router-view>
      </el-main>
    </el-container>
  </el-container>
</template>

<script>
export default {


  data() {
    return {
      f:null,
      aid:localStorage.getItem('AId'),
    }

  },
  mounted(){
    this.fool()
  },
  methods:
      {
        async logout()
        {
          localStorage.setItem('AId','')
          this.$router.push('/Alogin')
        },
        async fool()
        {

          if(localStorage.getItem('AId')==''){
            console.log('请先登录')
            this.$router.push('/Alogin')
          }
        }
      },

}
</script>
<style scoped>
.container {
  height: 100%;
}

.header {
  background-color: #007BFF; /* 更现代的蓝色 */
  color: #fff;
}

.aside {
  background-color: #F2F6FC; /* 浅灰色背景 */
}

.main {
  background-color: #FFFFFF;
  height: 100%;
}

/* header css */
.header .middle {
  line-height: 30px; /* 调整为与header高度一致 */
  text-align: center;
}

.header .logout {
  text-align: right;
  cursor: pointer;
}

.logout-link {
  background-image: linear-gradient(to right, #6a11cb 0%, #2575fc 100%); /* 渐变背景 */
  border-radius: 5px; /* 圆角 */
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1); /* 阴影 */
  padding: 10px 20px; /* 调整内边距 */
  font-size: 14px; /* 调整字体大小 */
  color: #fff; /* 文字颜色 */
  transition: all 0.3s ease; /* 过渡效果 */
  display: inline-flex; /* 使图标和文字水平排列 */
  align-items: center; /* 垂直居中 */
}

.logout-link:hover {
  background-image: linear-gradient(to right, #5a0e9b 0%, #2250fc 100%); /* 悬停时的渐变背景 */
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2); /* 悬停时的阴影 */
  transform: scale(1.05); /* 轻微放大 */
}

.el-link {
  color: #fff; /* 链接颜色 */
  margin-right: 20px; /* 确保退出链接不会贴边 */
}

/* 菜单项美化 */
.el-menu-item {
  transition: background-color 0.3s;
}

.el-menu-item:hover {
  background-color: #E6F7FF; /* 鼠标悬停效果 */
}

/* 侧边栏美化 */
.el-submenu__title:hover {
  background-color: #E6F7FF;
}
</style>